<!DOCTYPE html>
<html>
<head>
	<title>登录</title>
	<base href="http://localhost/">
	<link rel="stylesheet" type="text/css" href="css/login.css">
	<link rel="stylesheet" type="text/css" href="layui/css/layui.css">
	<script type="text/javascript" src="layui/layui.js"></script>
</head>
<body style="background:#009688;">
	<div style="position: absolute;left: 50%;top:50%;width:500px;margin-left: -250px;margin-top:-250px">
		<div style="background:#ffffff;padding: 20px;border-radius:4px;box-shadow: 5px 5px 20px #444444;">
			<div class="layui-form">

				<div class="layui-form-item" style="color:grey;">
					<h2 id="titlecolor">图书管理系统</h2>
					<hr>
				</div>
				<form method="post" action="<?=site_url('/User/signin')?>" name="form1">
					<div class="layui-form-item">
					    <label class="layui-form-label">用户名</label>
					    <div class="layui-input-block">
					      <input type="text" placeholder="请输入用户名" name="username" class="layui-input" id="username">
					    </div>
					</div>

					<div class="layui-form-item">
						<label class="layui-form-label">密&nbsp;&nbsp;&nbsp;&nbsp;码</label>
						<div class="layui-input-block">
						<input type="password" name="password" placeholder="请输入密码" class="layui-input">
						</div>
					</div>

					<div class="layui-form-item">
					    <label class="layui-form-label">验证码</label>
					    <div class="layui-input-inline">
					      <input type="text" class="layui-input">
					    </div>
					    <img src="" />
					</div>
					<div class="layui-form-item">
						<div class="layui-input-block layui-row">
							<div class="layui-col-md4 layui-col-md-offset1">
								<button class="layui-btn" type="submit" onclick=" return check(form1);">登录</button>
							</div>
							<div class="layui-col-md4">
							   <a class="layui-btn" href="<?php echo site_url('/User/register')?>">注册</a>
							</div>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>

	<script>
		function check(form){
			if(form.username.value == ""){
				alert("用户名不能为空");
				form.username.focus();
				return false;
			}
			if(form.password.value == ""){
				alert("密码不能为空");
				form.password.focus();
				return false;
			}
			form.submit;
		}

		layui.use(['layer'],function(){
		$ = layui.jquery;
		layer = layui.layer;

		//用户名控件获取焦点
		$('#username').focus();
		//回车登录
		$('input').keydown(function(e){
			if(e.keyCode == 13){
				dologin();
			}
		})
	})
	</script>
</body>
</html>